package PangController;


import PangModel.GameMap;
import PangModel.Hero;
import PangModel.UnsupportedArgumentException;

import java.awt.*;
import java.util.ArrayList;

/**
 * Created by baraaorabi on 4/23/15.
 */
public class MapEngine {
    GameMap myGameMap;
    ArrayList<ArrayList> gameObjects;

    public MapEngine ( ){


    }

    ArrayList<ArrayList> getGameObjects() {
        return gameObjects;
    }

    boolean setLevel(int level){

        myGameMap = new GameMap(level);

        gameObjects = myGameMap.getGameObjects();


        return true;
    }

    public boolean moveHero(int direction){
        try {
            myGameMap.moveHero(direction);
        } catch (UnsupportedArgumentException e) {
            e.printStackTrace();
        }
        return true;
    }

    public void shoot(){
        myGameMap.shoot();
    }

    public boolean decrementHeroLives() {

        return ((Hero)gameObjects.get(GameMap.HERO_INDEX).get(0)).hit();
    }

    public void drawObjects(Graphics page) {
        myGameMap.drawObjects(page);
    }
}
